Skip to content

TypeScript guidelines: Document any requirement for callback parameters subject to bidirectional assignment#170

Open
MajorLift wants to merge 2 commits intomainfrom
jongsun/typescript/callback-any-contravariance
Open

TypeScript guidelines: Document any requirement for callback parameters subject to bidirectional assignment#170
MajorLift wants to merge 2 commits intomainfrom
jongsun/typescript/callback-any-contravariance

Conversation

@MajorLift
Copy link
Copy Markdown
Contributor

@MajorLift MajorLift commented Apr 14, 2026

I keep encountering this pattern. Seems worth documenting, especially given function contravariance is confusing enough on its own.


Note

Low Risk
Documentation-only change that clarifies a narrow TypeScript typing edge case; no runtime or behavior impact.

Overview
Adds a new TypeScript guideline section explaining when any is the only workable type for callback parameter positions that are constrained from both sides (bidirectional assignment under --strictFunctionTypes contravariance).

Includes a concrete example contrasting unknown, never, and any, plus guidance that the eslint-disable is intentional and scoped to avoid propagating any.

Reviewed by Cursor Bugbot for commit 7849776. Bugbot is set up for automated code reviews on this repo. Configure here.

@MajorLift MajorLift force-pushed the jongsun/typescript/callback-any-contravariance branch from f5a6e91 to 77548ad Compare April 14, 2026 21:22
Comment thread docs/typescript.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant